package ac.github.os.internal.core.action.location.particle.matrix

import ac.github.os.internal.core.NameKey
import ac.github.os.internal.core.config.StringConfig
import ac.github.os.internal.core.config.get
import taboolib.common.platform.function.info
import taboolib.module.effect.Matrix
import taboolib.module.effect.Matrixs

interface MatrixAdapter : NameKey {

    companion object {
        val impls = arrayOf(
            RotateAroundXAxis(),
            RotateAroundYAxis(),
            RotateAroundZAxis()
        )
    }

    fun toMatrix(config: StringConfig): Matrix
}

class RotateAroundYAxis : MatrixAdapter {
    override fun toMatrix(config: StringConfig): Matrix {
        return Matrixs.rotateAroundYAxis(config.get("val", single = true, def = 0.0)!!)
    }

    override val namespace: String
        get() = "rotateYAxis"

}

class RotateAroundXAxis : MatrixAdapter {
    override fun toMatrix(config: StringConfig): Matrix {
        return Matrixs.rotateAroundXAxis(config.get("val", single = true, def = 0.0)!!)
    }

    override val namespace: String
        get() = "rotateXAxis"

}

class RotateAroundZAxis : MatrixAdapter {
    override fun toMatrix(config: StringConfig): Matrix {
        return Matrixs.rotateAroundZAxis(config.get("val", single = true, def = 0.0)!!)
    }

    override val namespace: String
        get() = "rotateZAxis"

}
